﻿using System;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace WAD.DAL
{
    public class DAOJubao : DAO
    {
        public static int Add(int user_id, int type, string radtype, string title, string url, string remark, string phone)
        {
            String sql = "insert into jubao(user_id,[type],radtype,title,url,remark,phone,date)values(@user_id,@type,@radtype,@title,@url,@remark,@phone,getdate())";
            Database db = GetDatabase();
            DbCommand cmd = db.GetSqlStringCommand(sql);
            db.AddInParameter(cmd, "@user_id", DbType.Int32, user_id);
            db.AddInParameter(cmd, "@type", DbType.Int32, type);
            db.AddInParameter(cmd, "@radtype", DbType.String, radtype);
            db.AddInParameter(cmd, "@title", DbType.String, title);
            db.AddInParameter(cmd, "@url", DbType.String, url);
            db.AddInParameter(cmd, "@remark", DbType.String, remark);
            db.AddInParameter(cmd, "@phone", DbType.String, phone);
            return db.ExecuteNonQuery(cmd);
        }
    }
}
